import { appTasks } from '@ohos/cangjie-build-support';
import { OhosHapContext, OhosPluginId, Product } from '@ohos/hvigor-ohos-plugin'
import { hvigor } from '@ohos/hvigor'
import { MeituanPlugin } from "@meituan/meat-harmony";

hvigor.afterNodeEvaluate(node => {
    let hapContext = node.getContext(OhosPluginId.OHOS_HAP_PLUGIN) as OhosHapContext;
    if (hapContext) {
        hapContext.targets((target: Target) => {
            const productName = target.getCurrentProduct().getProductName();
            if (productName == 'qishou') {
                let moduleJson = hapContext.getModuleJsonOpt() as moduleJsonOpt
                moduleJson.module.mainElement = 'QiShouAbility'
                hapContext.setModuleJsonOpt(moduleJson)
            } else if (productName == 'zhongbao') {
                let moduleJson = hapContext.getModuleJsonOpt() as moduleJsonOpt
                moduleJson.module.mainElement = 'ZhongBaoAbility'
                hapContext.setModuleJsonOpt(moduleJson)
            }
        })
    }
});

export default {
    system: appTasks,  /* Built-in plugin of Hvigor. It cannot be modified. */
    plugins:[]         /* Custom plugin to extend the functionality of Hvigor. */
}
